/*
 * Copyright 2007-2009 Perttu "celeron55" Ahola <celeron55@gmail.com>
 *
 * This file is part of jukumagic.
 *
 * jukumagic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * jukumagic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with jukumagic.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef NETLIST_H_
#define NETLIST_H_

#include "common.h"
#include "jukuobject.h"
#include "net.h"
#include "netcomponent.h"
#include <list>
#include <vector>

class Board;

class Netlist : public JukuObject
{
public:
	std::vector<Net*> m_nets;
	std::vector<NetComponent*> m_components;
	Netlist();
	~Netlist();
    JukuObjectType GetType()const{ return TYPE_NETLIST; }
	const wxChar * GetShortString(void){return NULL;}
	const wxChar * GetTypeString(void){return _("Netlist");}
	void WriteXML(TiXmlNode* root);
	void ReadBaseXML(TiXmlElement *element);
	static JukuObject* ReadFromXMLElement(TiXmlElement* element);
	Net* GetNetByPin(const NetPin &p);
	bool LoadFromSpiceFile(const char *filepath);
	bool LoadFromPartslistFile(const char *filepath);

	void SortNets();

	void ValidateNets(Board *board);
};

#endif
